<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>

</body>

</html>
<script>
    // 我们有一个存放了名字和姓氏的数组
    let arr = ["Ilya", "Kantor"]

    // 解构赋值
    // sets firstName = arr[0]
    // and surname = arr[1]
    let [firstName, surname] = "Ilya Kantor".split(' ');

    alert(firstName); // Ilya
    alert(surname);  // Kantor
    // 精简一下赋值
    let firstName = arr[0]

    // 不需要第二个元素
    let [firstName, , title] = ["Julius", "Caesar", "Consul", "of the Roman Republic"];

    alert(title); // Consul

    let user = {};
[user.name, user.surname] = "Ilya Kantor".split(' ');

alert(user.name); // Ilya
</script>